package net.whzjkj.gateway.tcpserver.service;

import lombok.extern.slf4j.Slf4j;
import net.whzjkj.gateway.tcpserver.config.RabbitConfig;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @description:
 * @author: Mr.Hu
 * @create: 2018-11-06 14:47
 **/
@Component
@Slf4j
public class SenderService {
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send(Object msg){
        String context = "hello " + new Date();
        System.out.println("Sender : " + context);
        amqpTemplate.convertAndSend(RabbitConfig.MESSAGE_DATA_QUEUENAME, msg);
    }
}
